package com.example.javafx.线条;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Line;
import javafx.scene.shape.StrokeLineCap;
import javafx.stage.Stage;

public class Main_2 extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Drawing lines");
        Group root = new Group();
        Scene scene = new Scene(root,300,150, Color.GRAY);
        Line readLine = new Line(10,10,200,10);
        readLine.setStroke(Color.RED);
        readLine.setStrokeWidth(10);
        readLine.setStrokeLineCap(StrokeLineCap.BUTT);
        readLine.getStrokeDashArray().addAll(15d,5d,15d,15d,20d);
        readLine.setStrokeDashOffset(10);
        root.getChildren().add(readLine);

        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
